//
//  GGThirdCell.m
//  Gunterapple
//
//  Created by 热带雨林 on 2020/4/3.
//  Copyright © 2020 热带雨林. All rights reserved.
//

#import "GGThirdCell.h"
#import "ZFBOptionModel.h"
#import "GGAddtion.h"
@interface GGThirdCell ()
@property (nonatomic, weak)UIImageView *icon;
@property (nonatomic, weak)UILabel *name;
@property (nonatomic, weak)UILabel *message;
@end
@implementation GGThirdCell
- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self setUI];
    }
    return self;
}
- (void)setUI{
    UIImageView *icon = [[UIImageView alloc]initWithFrame:CGRectZero];
    [self.contentView addSubview:icon];
    self.icon = icon;
    self.icon.layer.cornerRadius = 10;
    self.icon.clipsToBounds = YES;
    
    UILabel *name = [[UILabel alloc]init];
    [self.contentView addSubview:name];
    self.name = name;
    self.name.font = [UIFont systemFontOfSize:14];
    [self.name sizeToFit];
    
    UILabel *messageLab = [[UILabel alloc]init];
    [self.contentView addSubview:messageLab];
    self.message = messageLab;
    self.message.font = [UIFont systemFontOfSize:14];
    [self.message sizeToFit];

    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(10);
        make.centerY.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(37, 37));
    }];
    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.icon);
        make.left.equalTo(self.icon.mas_right).offset(8);
    }];
    [self.message mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-8);
        make.left.equalTo(self.icon.mas_right).offset(8);
        make.width.mas_lessThanOrEqualTo(@300);
    }];
}
- (void)setModel:(ZFBOptionModel *)model{
    _model = model;
    self.icon.image = [UIImage imageNamed:model.icon];
    self.name.text = model.name;
    self.message.text = model.message;
}
@end
